<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/7
 * Time: 12:37
 */

namespace app\api\behavior;

use app\common\model\Wallet;
use app\common\model\User;
use app\common\library\Auth;

class UserRegisterSuccessed
{

    public function run(&$params)
    {
        $salt = random(6);
        //插入钱包
        $wallet = new Wallet;
        $wallet->user_id    = $params->id;
        $wallet->money      = 0.00; //钱包余额
        $wallet->salt       = $salt;
        $wallet->pay_password = md5(md5($params->username) . $salt); //密码默认为账号，记得修改
        $wallet->site       = '';
        $wallet->save();
    }
}